Skip to content

Conversation

@chmerdon
Copy link
Member

@chmerdon chmerdon commented May 5, 2025

goal: efficient evaluation of many calls of interpolation on subsets (like in periodic coupling matrix generation)

outcome: completely replaced old point_evaluation!, point_evaluation_broken! by NodalInterpolator and ensure_moments! by MomentInterpolator and many custom interpolatioon in non-H1 finite elements by a common new FunctionalInterpolator structure; now every finite element interpolation is a composition of these three
interpolating structures that should perform much better in the goal scenario, since they keep all necessary data to run an evaluation

@chmerdon chmerdon changed the title use new stored transposed adjacency NodeCells restructuring of Interpolators May 7, 2025
@WIAS-PDELib WIAS-PDELib deleted a comment from pjaap May 7, 2025
@chmerdon
Copy link
Member Author

chmerdon commented May 7, 2025

Probably it is nicer if the interpolations are accessible via FESpace.interpolators[AT_NODES] instead of FESSpace[AT_NODES]?

@pjaap pjaap marked this pull request as ready for review May 12, 2025 14:59
@pjaap pjaap marked this pull request as draft May 12, 2025 15:00
chmerdon and others added 2 commits May 13, 2025 14:29
…now also used for interior Hdiv dofs, new FluxEvaluator evaluates normal/tangential fluxes for Hdiv/Hcurl boundary dofs)
@pjaap pjaap mentioned this pull request May 14, 2025
3 tasks
chmerdon added 5 commits May 14, 2025 11:52
…y NodalInterpolator

and ensure_moments! by MomentInterpolator and many custom interpolatioon
in non-H1 finite elements by a common new FunctionalInterpolator structure;
now every finite element interpolation is a composition of these three
interpolating structures
…ctionals in the FunctionInterpolator) that ensure that downstream tests work again
@pjaap pjaap marked this pull request as ready for review May 15, 2025 07:40
basis functions of the moments of type FEType_ref and with moments_operator. In the bestapprox mode
the mass matrix instead is formed from the scalar product of the interior basis functions.
"""
function MomentInterpolator(FE::FESpace{Tv, Ti, FEType, APT}, AT::Type{<:AssemblyType}, xgrid = FE.dofgrid; operator = Identity, FEType_ref = :auto, FEType_moments = :auto, moments_operator = operator, moments_dofs = Int[], bestapprox = false, order = 0, coffset::Int = -1, componentwise = true, kwargs...) where {Tv, Ti, FEType <: AbstractFiniteElement, APT}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reformat to a vertical argument list

end

## check if mass matrix can be computed once or needs to be recomputed on every mesh
if FEType_ref <: AbstractH1FiniteElement && !(FEType_ref <: AbstractH1FiniteElementWithCoefficients) && FEType_moments <: AbstractH1FiniteElement && moments_operator == Identity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like

Suggested change
if FEType_ref <: AbstractH1FiniteElement && !(FEType_ref <: AbstractH1FiniteElementWithCoefficients) && FEType_moments <: AbstractH1FiniteElement && moments_operator == Identity
if FEType_ref <: AbstractH1FiniteElement &&
!(FEType_ref <: AbstractH1FiniteElementWithCoefficients) &&
FEType_moments <: AbstractH1FiniteElement &&
moments_operator == Identity

AT::Type{<:AssemblyType} = ON_FACES,
xgrid = FE.dofgrid;
bonus_quadorder = 0,
operator = NormalFlux, nfluxes = 0, dofs = [], mean = false, kwargs...) where {Tv, Ti, FEType <: AbstractFiniteElement, APT}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consistent vertical list

H1Pk{2, 2, 5},
]
ExpectedOrders2D = [0, 1, 0, 0, 1, 1, 1, 2, 2, 3, 4, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5]
ExpectedOrders2D = [0, 1, 0, 0, 1, 1, 1, 2, 2, 3, 4, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be replaced by an array of pairs [ FEspace => expected_order ] ... 😄

println("error2 without kernel = $error2 (result = $result)")

return max(error1, error2) 0
return max(error1, error2) < 1e-15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, approx 0 is just = 0.

Note that x ≈ 0 (i.e., comparing to zero with the default tolerances) is equivalent to x == 0

@pjaap
Copy link
Member

pjaap commented May 15, 2025

Please

  • squash to less commits
  • add a CHANGELOG entry

@chmerdon chmerdon merged commit 7bb88b0 into master May 15, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants